import React, { Component } from 'react';
import {BackAndroid, Dimensions,PixelRatio} from 'react-native';

var screenW = Dimensions.get('window').width;
var screenH = Dimensions.get('window').height;
/*var fontScale =PixelRatio.getFontScale();
var pixelRatio =PixelRatio.get();*/
const r2=2;
const w2 = 750/r2;
const h2 = 1334/r2;
const DEFAULT_DENSITY=2;

/**
 * 屏幕适配,缩放size
 * @param size
 * @returns {Number}
 * @constructor
 */
function _scaleSize(size:Number) {
    var scaleWidth = screenW / w2;
    var scaleHeight = screenH / h2;
    var scale = Math.min(scaleWidth, scaleHeight);
    size = Math.round((size * scale + 0.5));
    return size/DEFAULT_DENSITY;
}

var _Environments = {
    production:{
      	scaleSize:_scaleSize,
    },
    staging:{
		scaleSize:_scaleSize,
    },
    development:{
		scaleSize:_scaleSize,
  }
}
function getEnvironments(){
  return _Environments[process.env.NODE_ENV];
}
var Environments = getEnvironments();
module.exports = Environments;